
package com.yuan.servlet;

import com.yuan.hibernate.员工活动轨迹表;
import com.yuan.hibernate.员工活动轨迹表DAO;
import com.yuan.util.TimeUtil;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class updatelocation extends BaseHttpServlet {
    private 员工活动轨迹表DAO m员工活动轨迹表DAO = null;
    private 员工活动轨迹表 m员工活动轨迹表 = null;

    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        super.doGet(request, response);
        m员工活动轨迹表DAO = new 员工活动轨迹表DAO();
        int userid = -1;
        double lat = 0.0, lng = 0.0;
        String time = "";
        try
        {
            userid = Integer.parseInt(request.getParameter("userid"));
            lat = Double.parseDouble(request.getParameter("lat"));
            lng = Double.parseDouble(request.getParameter("lng"));
            time = request.getParameter("time");
        } catch (Exception e)
        {
            e.printStackTrace();
        }
        if (!TimeUtil.isCheckRightTime(time)) {
            mResponse = "输入时间异常";
        }
        m员工活动轨迹表 = new 员工活动轨迹表();
        m员工活动轨迹表.set序号(userid);
        m员工活动轨迹表.setLat(lat);
        m员工活动轨迹表.setLng(lng);
        m员工活动轨迹表.set时间(time);
        m员工活动轨迹表DAO.save(m员工活动轨迹表);
        closeAndClear();
    }

    protected synchronized void closeAndClear() {
        m员工活动轨迹表DAO = null;
        m员工活动轨迹表 = null;
        super.closeAndClear();
    }
}
